const system = {
  alipayAd: {
	  id: '',
	  user:  '',
	  callback: '',
	  cid: '',
  },
  platform: '',
  version: '',
  set(platform, version) {
	  this.platform = platform;
	  this.version = version;
  },
  setAlipayAdParams({platform, id, plan, user, callback, cid}) {
	  // if (platform == 'MP_ALIPAY') {
		 //  this.alipayAd = {
			//   id, plan, user, callback: decodeURIComponent(callback), cid
		 //  }
	  // }
  },
  headers(header) {
	  return Object.assign({
		  'x-platform': this.platform,
		  'x-version': this.version,
		  ...header
	  }, this.alipayAd.callback ? {
		  'x-alipay-ad-id': this.alipayAd.id,
		  'x-alipay-ad-plan': this.alipayAd.plan,
		  'x-alipay-ad-user': this.alipayAd.user,
		  'x-alipay-ad-callback': this.alipayAd.callback,
		  'x-alipay-ad-cid': this.alipayAd.cid,
	  } : {})
  }
};

export default system;